{extend name="public:layout" /}
{block name="title"}模型管理{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 模型管理</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <div class="pull-left">
                    <a class="btn btn-primary" href="{:url('add')}">
                        <i class="fa fa-plus"></i>&nbsp;添加模型
                    </a>
                    <a href="{:url('updateCache')}" class="btn btn-info">更新缓存</a>
                </div>
                <div class="clearfix"></div>
            </div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="50">#</th>
                    <th>模型名称</th>
                    <th>对应表名</th>
                    <th>列表模板</th>
                    <th>添加模板</th>
                    <th>编辑模板</th>
                    <th>状态</th>
                    <th>绑定分类</th>
                    <th>系统</th>
                    <th width="240">操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo.mid}</td>
                    <td>{$vo.moudle_name}</td>
                    <td>{$vo.table_name}</td>
                    <td>
                        <a href="javascript:;" onclick="showTpl('{$vo.mid}','list_tpl')">{$vo.list_tpl}</a>
                    </td>
                    <td>
                        <a href="javascript:;" onclick="showTpl('{$vo.mid}','add_tpl')">{$vo.add_tpl}</a>
                    </td>
                    <td>
                        <a href="javascript:;" onclick="showTpl('{$vo.mid}','edit_tpl')">{$vo.edit_tpl}</a>
                    </td>
                    <td>{$vo.enable_text}</td>
                    <td>{$vo.is_bind_text}</td>
                    <td>{$vo.is_system_text}</td>
                    <td>
                        <a href="{:url('buildmodel',['mid'=>$vo['mid']])}">模型生成</a>
                        <a href="{:url('field/index',['mid'=>$vo['mid']])}">字段管理</a>
                        <a href="{:url('edit',['mid'=>$vo['mid']])}">编辑</a>
                        {eq name="vo.is_system" value="1"}
                        内置模型
                        {else/}
                        <a href="javascript:;" onclick="doAction(this);"
                           data-msg="确认删除吗？" data-url="{:url('del')}" data-params="mid={$vo.mid}">删除</a>
                        {/eq}
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
    <script>
        function showTpl(mid,tpl) {
            In('layer',function () {
                layer.open({
                    title:'html模板',
                    type: 2,
                    content: "{:url('moudle/buildHtml')}?mid="+mid+"&tpl="+tpl,
                    area: ['760px', '500px'],
                    closeBtn:1
                });
            })
        }
    </script>
{/block}